import request from '@/utils/request'
import { AxiosPromise } from 'axios'

enum Api {
  list = '/charger/gun/list',
  delete = '/charger/gun/delete',
  batchDelete = '/charger/gun/batchDelete',
  add = '/charger/gun/add',
  edit = '/charger/gun/edit',
  detail = '/charger/gun/detail',
  bindParking = '/charger/gun/bindParking',
  optionSelect = 'charger/gun/optionSelect',
}

// 获取列表
export const chargerGunList = (data: any): AxiosPromise<any> => {
  return request({
    url: Api.list,
    method: 'post',
    data,
  })
}

// 获取列表
export const optionSelect = (data: any): AxiosPromise<any> => {
  return request({
    url: Api.optionSelect,
    method: 'post',
    data,
  })
}

// 删除
export const chargerGunDelete = (data: string) => {
  return request({
    url: Api.delete,
    method: 'post',
    data,
  })
}
// 批量删除
export const chargerGunBatchDelete = (data: (string | number)[]) => {
  return request({
    url: Api.batchDelete,
    method: 'post',
    data,
  })
}

// 编辑、保存
export const chargerGunSave = (data: any) => {
  return request({
    url: data.id ? Api.edit : Api.add,
    method: 'post',
    data,
  })
}

// 获取设备详情
export const chargerGunDetail = (data) => {
  return request({
    url: Api.detail,
    method: 'post',
    data,
  })
}

// 编辑、保存
export const bindParking = (data: any) => {
  return request({
    url: Api.bindParking,
    method: 'post',
    data,
  })
}
